package com.imooc.sell.utils.wang;

import com.imooc.sell.VO.wang.InParamVO.OrderDetailVO;
import com.imooc.sell.dataobject.OrderDetail;
import org.junit.Test;

import java.util.ArrayList;
import java.util.List;

public class OutUtils {
    public static List<OrderDetail> Foods2OrderDetailList(List<OrderDetailVO> list) {
        List<OrderDetail> orderDetailList = new ArrayList<>();
        for (OrderDetailVO orderDetailVO : list) {
            OrderDetail orderDetail = new OrderDetail();
            orderDetail.setProductId(orderDetailVO.getProduct_id());
            orderDetail.setProductName(orderDetailVO.getName());
            orderDetail.setProductPrice(orderDetailVO.getPrice());
            orderDetail.setProductQuantity(orderDetailVO.getQuantity());

            //src="/sell/static/images/${productinfo.productIcon}.jpg"

            //修改图片路径
            // orderDetail.setProductIcon("http://bread.s1.natapp.cc/sell/static/images/"+orderDetailVO.getProductIcon()+".jpg");
            orderDetail.setProductIcon(orderDetailVO.getProductIcon());
            orderDetailList.add(orderDetail);
        }
        return orderDetailList;
    }

}
